﻿@using Model.WXshopBuiness
@using Xproject.Util
@{
    Layout = null;
    Layout = "~/Views/Shared/_JSlayout.cshtml";
    string Domain = CommonHelper.GetAppSettings("Domin");
}
@model List<Address>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes" />
    <title>我的收货地址</title>

    <link href="~/Content/bootstrap.css" rel="stylesheet" />
    <link href="~/Content/css/shop/home.css" rel="stylesheet" />

    <link href="http://at.alicdn.com/t/font_u5tafk2orz281tt9.css" rel="stylesheet" type="text/css" />

    <style>
        .form-group {
            border-bottom: 1px solid #ececec;
            overflow: hidden;
           margin-top:5px;
            margin-bottom: 0;
        }

            .form-group .col-xs-4 {
                padding-left: 0;
             
                color: #333;
            }

            .form-group .col-xs-8 {
                padding: 0;
            }

        .control-label {
            line-height: 2.143em;
            text-align: right;
        }

        .form-control {
            box-shadow: none;
            padding: 0 0.429em;
            height: 2.143em;
            border: none;
        }
      
    </style>

</head>

<body>

    <!--top-->
    <div class="top_c">
        <a href="~/UserCenter/UserCenter" class="iconfont icon-jiantou-copy-copy"></a>
        <a href="@(Domain)/Address/AddressEdit" class="ming">添加</a>
            <p class="titi">收货地址</p>
    </div>

    <!--内容-->
    <div class="addr">
        <div class="container">
            @foreach (Address ad in Model)
            {
                <div class="add" id="@ad.AddressID">
                    <p>@ad.Receiver<i>@ad.Phone</i></p>
                    <span>@(ad.Area+" "+ad.DetailAddress)</span>
                    <div class="mo">
                        <label class="checkbox-inline">
                            <input type="checkbox" id="inlineCheckbox1" value="option1" @(ad.IsDefault == 1 ? "checked" : "")> 设为默认
                        </label>
                        <a href="#" onclick="DelthisAddr('@ad.AddressID')"><span class="iconfont icon-iconfontshanchu"></span>删除</a>
                        <a href="@(Domain)/Address/AddressEdit?addressId=@(ad.AddressID)"  ><span class="iconfont icon-bianji"></span>编辑</a>
                    </div>
                </div>
            }
        </div>
    </div>
  

    <script src="~/Scripts/shop/jquery.min.js"></script>
    <script src="~/Scripts/iscroll.js"></script>

    <script src="~/Scripts/bootstrap.min.js"></script>
    <script src="~/Scripts/shop/index.js"></script>
    <script type="text/javascript">
        function DelthisAddr(addressId) {

            layer.open({
                content: '您确定要删除此收货地址吗？'
                , btn: ['确定', '不要']
                , yes: function (index) {

                         $.ajax({
                            type: "POST",
                            url: '@(Domain)/Address/DelAddr',
                            data: { addressId: addressId  },
                            cache: false,

                            success: function (data) {
                                $("#" + addressId).remove();
                                layer.open({
                                    content: data.Data
                                    , skin: 'msg'
                                    , time: 2 //2秒后自动关闭
                                });
                            }
                        });
                }
            });

        }

    </script>

</body>
</html>
